package com.liujit.standard.basis.core.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.liujit.standard.basis.core.util.JsonUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;


/**
 * @description: Jackson 配置
 * @author: liujun
 * @create: 2021/3/24 5:31 下午
 **/
@Configuration
@ConditionalOnClass(ObjectMapper.class)
public class JacksonConfig {

    @Bean
    public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
        ObjectMapper objectMapper = builder.createXmlMapper(false).build();
        JsonUtil.initObjectMapper(objectMapper);
        return objectMapper;
    }

}
